package cn.yuanqiao.web.controller.activiti;

import cn.yuanqiao.activiti.domain.ActHistoryTaskDTO;
import cn.yuanqiao.activiti.domain.ActTaskDTO;
import cn.yuanqiao.activiti.service.IActTaskService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.page.PageDomain;
import cn.yuanqiao.common.web.page.TableDataInfo;
import cn.yuanqiao.common.core.page.TableSupport;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/activiti/workflowArchiveBjfb")
public class YqdaWorkflowBjfbController extends BaseController {

    @Autowired
    private IActTaskService actTaskService;

    //获取我的代办任务
    @GetMapping(value = "/taskList")
    public TableDataInfo getTasks(@RequestParam(value = "instanceName",required = false) String instanceName) {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Page<ActTaskDTO> hashMaps = actTaskService.selectProcessDefinitionListByCode(pageDomain,"WorkFlow_Archive_Bjfb",instanceName);
        return getDataTable(hashMaps);
    }

    //获取我的代办任务
    @GetMapping(value = "/taskHistoryList")
    public TableDataInfo getTaskHistoryList(@RequestParam(value = "instanceName",required = false) String instanceName) {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Page<ActHistoryTaskDTO> hashMaps = actTaskService.selectProcessDefinitionListHistoyByCode(pageDomain,"WorkFlow_Archive_Bjfb",instanceName);
        return getDataTable(hashMaps);
    }
}
